package com.wsq.roomdemo;

import androidx.appcompat.app.AppCompatActivity;
import androidx.room.Room;

import android.os.Bundle;
import android.util.Log;

import com.wsq.roomdemo.room.AppDatabase;
import com.wsq.roomdemo.room.dao.VoiceDao;
import com.wsq.roomdemo.room.entity.VoiceEntity;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        VoiceEntity voiceEntity = new VoiceEntity();
        voiceEntity.voiceIconPath = "iconPath";
        voiceEntity.voiceName = "小丽";
        voiceEntity.voicePath = "voicePath";

        AppDatabase appDatabase = Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "sihao-me_db").allowMainThreadQueries().build();
        appDatabase.voiceDao().insert(voiceEntity);

        VoiceEntity voiceEntity1 = (VoiceEntity) appDatabase.voiceDao().getAll().get(0);
        Log.e("112", voiceEntity.voiceIconPath);

    }
}